1. Field of the Invention
The present invention relates generally to optimizing tessellation operations in a graphics processing unit.
2. Background
A graphics processing unit (GPU) is a special-purpose integrated circuit optimized for graphics processing operations. A GPU is often incorporated into computing devices (e.g., personal computers, rendering farms or servers, handheld devices, digital televisions, etc.) used for executing applications with demanding graphics processing needs, such as, for example, video game applications.
In most modern GPU implementations, the processing of graphics operations is broken into various functional units, each located within a different stage of a processing pipeline. Typically, input to the GPU is in the form of a set of vertices as well as some connectivity information identifying how the vertices are connected to each other. A set of vertices coupled with connectivity information for that set of vertices defines a geometric primitive. Often, the geometric primitive of choice is a triangle, which is defined by three vertices and three edges, the edges represented as connectivity information.
As each geometric primitive is processed by the GPU for rendering, individual vertices are processed by a vertex shader. The vertex shader is generally used to perform operations that apply to individual vertices. Examples of these operations include transform operations and lighting operations. As a result of these operations, data regarding a computed vertex position, the color of the primitive at that vertex, and texture coordinates at that vertex for texture mapping are generally computed.
After computations involving individual vertices are performed, an additional stage of the pipeline may perform operations on primitives as a whole. This stage, commonly referred to as the geometry shader, can apply graphics techniques to an entire primitive, potentially resulting in the creation of additional primitives. For example, a geometry shader can be used to apply a displacement map, for repositioning the vertices, or for applying fur and fin techniques.
Upon completion of the geometry shader stage, the output is commonly sent to a rasterizer for conversion into a two-dimensional image, and further enhancements can be performed by a pixel shader.
The techniques performed by the geometry shader typically result in the creation of additional primitives for the purpose of enhancing the appearance of a rendered object. By applying a displacement map, for example, additional primitives are generated in order to provide additional vertices, which are then displaced according to a texture bitmap. Generally, as more primitives are used in the computation of the technique, the smoother and more realistic the final object will appear. However, providing too many vertices can overwhelm the vertex and geometry shaders, and may not result in a noticeably improved rendering of the object, particularly when the object being rendered is located at a significant distance from the viewing plane.
Prior implementations have relied on using a tessellation engine to increase the number of primitives immediately prior to the vertex shader stage. For example, commonly-owned U.S. Patent Application Publication No. 2004/0085312 to Buchner et al. (application Ser. No. 10/287,143), which is herein incorporated by reference in its entirety, discloses a method and apparatus for performing such tessellation. However, previous implementations have simply allowed for output from the tessellation engine to be processed by the vertex shader, then transmitted to the rasterizer for rendering to the display. If a developer using a prior implementation wanted to increase the primitive count by tessellating the primitives, then running the tessellated primitives through the geometry shader, it was necessary to store the tessellated output somewhere in memory. The developer would then need to re-run the GPU pipeline on the tessellated data in order to allow the geometry shader to perform its computations on the tessellated data.
Accordingly, what are needed are improved techniques to reduce the rendering costs attributed to tessellation when further processing tessellated data in a geometry shader.